package com.dtx.dao;

import com.dtx.entity.SysUser;
import org.beetl.sql.mapper.BaseMapper;
import org.beetl.sql.mapper.annotation.*;
import org.springframework.stereotype.Repository;

@SqlResource("beetl.sysUser")
@Repository
public interface SysUserDao extends BaseMapper<SysUser> {

    @Sql("select * from sys_user where id = ?")
    @Select
    SysUser querySysUserById(Integer id);

    @Sql("update sys_user set name=? where id = ?")
    @Update
    int updateName(String name,Integer id);

    @Template("select * from sys_user where id = #{id}")
    SysUser getUserById(Integer id);

    @Template("select * from sys_user where id = #{id}")
    SysUser getUserByIdByParam(@Param("id") Integer userId);

    @Template("select * from sys_user where id = #{id}")
    SysUser getUserById(SysUser user);

    @Template("select * from sys_user where id = #{id}")
    SysUser getUserByIdByRoot(@Root SysUser user);

    @Template("select * from sys_user where id = #{id} and status=#{myStatus}")
    SysUser getUserById(Integer myStatus,@Root SysUser user);
}
